package com.source.lightfowl.barcodeMachineGrantAndRecovery.dao;

import com.source.lightfowl.barcodeMachineGrantAndRecovery.pojo.BarcodeMachineRecovery;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * @Author: 谢春泳
 * @Description: 脚标机回收管理接口
 * @Date: 2020.3.16
 */
public interface BarcodeMachineRecoveryVersion2Dao extends JpaRepository<BarcodeMachineRecovery,Integer>, JpaSpecificationExecutor<BarcodeMachineRecovery> {

    //批量删除
    @Modifying
    @Transactional
    @Query("delete from BarcodeMachineRecovery s where s.id in(?1)")
    void deleteBatch(ArrayList<Integer> ids);

    //根据脚标机的id查找
    @Query("from BarcodeMachineRecovery s where s.barcodeMachineId = (?1)")
    List<BarcodeMachineRecovery> findByBarcodeMachineId(Integer id);
}
